package com.lc.afbx.conn;

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;
import com.zcx.helper.http.note.HttpServer;
import com.zcx.helper.http.note.HttpUpload;

import org.json.JSONObject;

/**
 * Created by Administrator on 2016/7/12.
 */
@HttpInlet(Conn.INLET_API_INSURANCE_LIFE)
public class PostApiSubmitShouXian extends BaseAsyPost<PostApiSubmitShouXian.Info> {
    public String userid, product_id, starttime, copies, payment_way, relation, applicant_information,
            death_beneficiary, other_insureds, stores_id, manager_code, id_url, self_url, otherid_url, otherself_url;

    public PostApiSubmitShouXian(AsyCallBack<PostApiSubmitShouXian.Info> asyCallBack) {
        super(asyCallBack);
    }

    protected Info parser(JSONObject jsonObject) {

        TOAST = jsonObject.optString("message");

        if (jsonObject.optInt("code") == 200) {

            Info info = new Info();

            info.code = jsonObject.optString("code");
            info.message = jsonObject.optString("message");

            Data data = new Data();
            JSONObject o = jsonObject.optJSONObject("data");

            data.nickname = o.optString("nickname");
            data.tel = o.optString("tel");

            info.data = data;

            return info;

        }

        return null;
    }

    @Override
    protected boolean skipSecret(String key) {
        return key.equals("id_url") || key.equals("self_url") || key.equals("otherid_url") || key.equals("otherself_url");
    }

    public static class Info {

        public String code, message;
        public Data data;
    }

    public static class Data {
//        {"nickname":"\u5c0f\u660e","tel":"13101618368"}

        public String nickname, tel;
    }
}
